import { Sequelize } from "sequelize-typescript";
import db  from '../../config/db';

const sequelize = new Sequelize(
    db.mysql.database,
    db.mysql.user,
    db.mysql.password || null,
    {
        host: db.mysql.host,
        port: db.mysql.port,
        dialect: 'mysql',
        pool: {
            max: 5,
            min: 0,
            acquire: 30000,
            idle: 10000
        },
     timezone: '+08:00', // 东八时区
    }
);


sequelize.authenticate().then(() => {
    console.log('数据库连接成功！');
}).catch(err => {
    console.error('数据库连接失败！', err);
});


export default sequelize;

export function query(sql: string, arg1: { type: any; }) {
    throw new Error('Function not implemented.');
}
